#include <iostream>
#include <algorithm>
using namespace std;

int reverse(int x) {
    bool isNE = 0;
    long long xl = x;
    if(xl < 0){
        isNE = 1;
        xl = -xl;
    }
    string s = to_string(xl);
    std::reverse(s.begin(), s.end());
    long long yl = stol(s);
    if(yl > INT32_MAX) return 0;
    if(isNE) return -(int)yl;
    return (int)yl;
}

int main(){
    int x = 120;
    int ans = reverse(x);
    cout << ans << endl;
    return 0;
}